<!DOCTYPE html>

<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="format-detection" content="telephone=no" />
    <title>医院详情</title>
    <link href="../css/ekang.css" rel="stylesheet" />
    <link href="../css/chooseDoctor_css/style.css" rel="stylesheet" />
    <link href="../css/chooseDoctor_css/styleProgress.css" rel="stylesheet" />
    <link rel="stylesheet" href="../css/framework7.ios.min.css">
    <link rel="stylesheet" href="../css/framework7.ios.colors.min.css">
    <!-- Path to your custom app styles-->
    <link rel="stylesheet" href="../css/my-app.css">
    <link rel="stylesheet" href="../css/ekang.css"/>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            font-size: 14px;
            margin: 0;
            padding: 0;
            color: #6C6C6C;
            background-color: #f2f2f2;
            overflow: scroll;
        }

        .reservation {
            background-color: #ffffff;
            border-bottom: solid 1px #e6e6e6;
        }

        .reservation_title {
            padding: 7px;
            color: #43af80;
            font-size: 13px;
            border-bottom: solid 1px #e6e6e6;
        }

        .reservation_title img{
            width: 12px;
            height: 12px;
            margin-right:5px;

        }
        .reservation_table {
            text-align: center;
            padding: 7px;
        }

        #reservation_table a {
            /* color: #FFFFFF;*/
        }

        .special_border {
            border-collapse: inherit;
            border-spacing: 1px;
        }

        .reservation table {
            width: 100%;
            background-color: #e6e6e6;
        }

        .reservation td {
            background-color: white;
            text-align: center;
            width: 40px;
            height: 40px;
        }
        .reservation td.hover{
            background-color: #43af80;
            color: #fff;
        }
        .reservation .font {
            font-size: 11px;
            color: #4a4a4a;
        }

        .reservation .num {
            font-size: 12px;
            color: #00b57d;

        }
        .reservation span.hover{
            color:#fff;
        }
        .reservation .title {
            font-size: 11px;
        }

        table {
            width: 100%;
        }

        .reservation_time{
            font-family:STHeiti;
            font-weight: inherit;
            text-align: center;
            font-size: 13px;
            margin-top: 10px;
            color: #79807d;
            font-style: inherit;
        }

        .commment_list img{
            width: 15%;
            margin-left: 10px;
            margin-top: 10px;
            float: left;
        }


        .backView {
            width: 100%;
            height: 50px;
            margin-top: 10px;
            background-color: #fff;
            border-top: 1px solid #dddddd;
            border-bottom: 1px solid #dddddd;
            list-style-type: none;
        }

        .li-title {
            position: absolute;
            color: #333333;
            font-size: 14px;
            left: 12px;
            line-height: 50px;
            /*font-weight: bold;*/
        }

        .choose {
            float:left;
            margin:0 0px;
            display:inline;
            color: #333333;
            font-size: 14px;
            margin-top: 13px;
            height: 24px;
            line-height: 24px;
            border-radius: 12px;
        }

        .choose-on {
            background-color: #43af80;
            color: #fff;
        }

        #nures_time ::-webkit-input-placeholder { color: #333333;text-align: right }

        ::-webkit-input-placeholder { color: #b3b3b3;}
        input:-moz-placeholder { color: #b3b3b3; }

        .li-text {
            position: absolute;
            color: #b3b3b3;
            border: none;
            outline: none;
            font-size: 15px;
            line-height: 45px;
            right: 0;
            width: 60%;
            text-align: right;
            background-color: rgba(102, 102, 102, 0);
        }

        .li-title-detail {
            position:absolute;
            color: #b3b3b3;
            border: none;
            outline: none;
            font-size: 15px;
            right: 0;
            text-align: left;
            /*background-color:#009688;*/
            width: 94%;
            height: 79px;
            left: 10px;
            top: 5px;
        }

        .icon-right {
            background: url(../img/right_24.png) no-repeat 98% center transparent;
            background-color: #fff;
            background-size: 12px 12px;
        }

        .tabs-choose {
            /*height: 50px;*/
            line-height: 50px;
            position: absolute;
            background-color: rgba(255, 255, 255, 0);
            right: 25px;
            color: #333333;
        }

        .tabs-choose div {
            background-origin: content-box;
            font-size: 14px;
            text-align: right;
        }
    </style>

</head>
<body>

<!--// 导航条-->
<div style="width: 100%;height: 45px;background-color: #38a16d;position: fixed;z-index: 10000">
    <h1 class="nav-title" style="font-size: 18px;line-height: 45px">科室</h1>
    <img src="../img/BackIcon.png" alt="返回" class="nav-backImg" id="back"/>
</div>

<div style="margin-top: 45px">

    <ui>
        <li id="hospitalDetail" class="backView icon-right" style="margin-top: 0">
            <span class="li-title" id="chooseText">选择医院科室</span>
            <div class="tabs-choose text-center"></div>
        </li>
    </ui>

    <div class="backView" style="margin-top: 10px">
        <span class="li-title">挂号类型</span>
        <div style="margin-left: 75px">
            <ui>
                <li data-id="1" onclick="chooseType($(this))" class="choose choose-on">&nbsp&nbsp普通&nbsp&nbsp</li>
                <li data-id="2" onclick="chooseType($(this))" class="choose">&nbsp&nbsp专家&nbsp&nbsp</li>
                <li data-id="3" onclick="chooseType($(this))" class="choose">&nbsp&nbsp特需门诊&nbsp&nbsp</li>
                <li data-id="4" onclick="chooseType($(this))" class="choose">&nbsp&nbsp指定专家&nbsp&nbsp</li>
            </ui>
        </div>

    </div>

    <div class="backView icon-right" id="choose_expert">
        <span class="li-title">指定专家</span>
        <div id="expert_text" class="tabs-choose text-center">选择指定专家类型后才可以指定专家</div>
    </div>

    <!-- 预约日期 -->
    <div class="reservation" style="margin-top: 10px;border-top: 1px solid #e6e6e6">
        <div class="reservation_title">
            <img src="../img/doctorDetail/docter/矩形-3@2x.png">
            就诊时间
        </div>

        <!--滚动-->
        <div class="container" style="height: 210px">
            <section class="sample" data-slidizle>

                <ul class="slider-content" data-slidizle-content>

                    <li class="slider-item">

                        <div class="reservation_time" id="table_time_01">
                            日期
                        </div>
                        <div class="reservation_table">
                            <table id="table01" class="special_border" cellspacing="1" cellpadding="5">
                                <tr>
                                    <td class="t_l_radius"><img src="../img/doctorDetail/calendar.png" width="18" height="18" /></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td class="t_r_radius"></td>
                                </tr>
                                <tr>
                                    <td class="title">上午</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td class="title">下午</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>

                            </table>
                        </div>
                    </li>

                    <li class="slider-item">

                        <div class="reservation_time" id="table_time_02">
                            日期
                        </div>
                        <div class="reservation_table">
                            <table id="table02" class="special_border" cellspacing="1" cellpadding="5">
                                <tr>
                                    <td class="t_l_radius"><img src="../img/doctorDetail/calendar.png" alt="" width="18" height="18" /></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td class="t_r_radius"></td>
                                </tr>
                                <tr>
                                    <td class="title">上午</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td class="title">下午</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>

                            </table>
                        </div>
                    </li>


                    <li class="slider-item">
                        <div class="reservation_time" id="table_time_03">
                            日期

                        </div>
                        <div class="reservation_table">
                            <table id="table03" class="special_border" cellspacing="1" cellpadding="5">
                                <tr>
                                    <td class="t_l_radius"><img src="../img/doctorDetail/calendar.png" width="18" height="18" /></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td class="t_r_radius"></td>
                                </tr>
                                <tr>
                                    <td class="title">上午</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td class="title">下午</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>

                            </table>
                        </div>
                    </li>

                </ul>

                <!-- 下面三个点 -->
                <ul class="slider-navigation" data-slidizle-navigation>
                    <!-- automatically generated navigation -->
                </ul>

            </section>
        </div>

    </div>
    <!--// 列表-->
    <ui>
        <li class="icon-right backView" id="choosePeople">
            <span class="li-title">就诊患者</span>
            <div id="user_name" class="tabs-choose text-center">点击选择</div>
        </li>
        <li class="backView">
            <span class="li-title">备用联系人</span>
            <input type="number" id="mobile" placeholder="请输入备用联系人手机号" class="li-text"/>
        </li>
        <li class="backView">
            <span class="li-title">陪诊服务（<span id="severMoney"></span>元/次，陪诊4小时）</span>
            <label class="label-switch" style="position:absolute;right: 10px;margin-top:9px">
                <input type="checkbox">
                <div id="severChoose" class="checkbox"></div>
            </label>
        </li>
        <li class="backView">
            <span class="li-title">专车接驾（<span id="carMoney"></span>元/次）</span>
            <label class="label-switch" style="position:absolute;right: 10px;margin-top:9px">
                <input type="checkbox">
                <div id="carCheck" class="checkbox"></div>
            </label>
        </li>
        <li class="icon-right backView">
            <span class="li-title">诊疗金</span>
            <div id="diagnosis_money"  class="tabs-choose text-center">点击选择</div>
        </li>
        <li class="backView" style="position:relative;height: 89px">
            <textarea id="diseaseText" class="li-title-detail" placeholder="请简单的描述患者的病情或就诊经历"></textarea>
        </li>
    </ui>
    <p class="message" style=" margin-bottom:10%;font-size: 12px;color: #999999"><span style="font-size: 13px;color: rgb(102, 102, 102)">服务说明</span>陪珍的服务费价格为388元一次，服务范围包括帮排队、帮跑腿、帮您各种就诊相关所需，专车接驾150/次(5环以内)，5环以外按实际价格补齐差价</p>
    <br/>
    <br/>
    <div style="position: fixed;display: flex;height: 49px;width: 100%;background-color: #393d3b;bottom: 0">
        <!--<div style="position: absolute;left: 10px;line-height: 49px;font-size: 13px;color: #fff">服务费：<span id="money_num">188</span>元</div>-->
        <div id="submitOrder" style="position: absolute;right: 0;width: 100%;height: 49px;background-color: #26d086;font-size: 16px;color: #fff;text-align: center;line-height: 49px">立即预约</div>
    </div>
</div>



<script src="../js/jquery-1.10.2.js" type="text/javascript"></script>
<script src="../js/ekang.js"></script>
<script src="../js/jquery.slidizle.js"></script>
<script src="../js/jquery.cookie.js"></script>
<script>

    var register_type = 1;
    var doctorId;
    var doctorName;
    var app;

    $(function () {

        $('#chooseText').html($.cookie("hospital_name")+$.cookie("department_name"));

        $('.nav-title').html($.cookie("department_name"));

        // 诊疗金数据
        var diagName;
        var diagId;

        var sever = 0;
        var car = 0;

        var severNum;
        var carNum;
        var time;
        var appointment_time;

        $('#severChoose').on('click', function () {
            if($('input[type="checkbox"]')[0].checked == false){
                $('#money_num').html(parseInt($('#money_num').text())+severNum);
                $.cookie("sever", "1", { expires: 7,path: '/' });
                sever = 1;
            }else{

                if($('#diagnosis_money').html()!='点击选择'){
                    var zlj = parseInt($.cookie("dia_name"));
                    var Money = parseInt($('#money_num').html());
                    $('#money_num').html(zlj+Money)
                }
                $('#money_num').html(parseInt($('#money_num').text())-severNum);
                $.cookie("sever", "0", { expires: 7,path: '/' });
                sever=0;
                $('#diagnosis_money').html('点击选择')
            }
        });

        $('#carCheck').on('click', function () {
            if($('input[type="checkbox"]')[1].checked == false){
                $('#money_num').html(parseInt($('#money_num').text())+carNum);
                $.cookie("car", "1", { expires: 7,path: '/' });
                car = 1;
            }else{
                if($('#diagnosis_money').html()!='点击选择'){
                    var zlj = parseInt($.cookie("dia_name"));
                    var Money = parseInt($('#money_num').html());
                    $('#money_num').html(zlj+Money)
                }
                $('#money_num').html(parseInt($('#money_num').text())-carNum);
                $.cookie("car", "0", { expires: 7,path: '/' });
                car = 0;
                $('#diagnosis_money').html('点击选择')
            }
        });

        // 挂号类型
        if($.cookie("register_num")){
            var registerNum = $.cookie("register_num");
            register_type = registerNum;
            if(registerNum == 4){
                if($.cookie("hospital_doctor_name")){
                    $('#expert_text').html($.cookie("hospital_doctor_name"));

                    $('#expert_text').attr('data-id',$.cookie('hospital_doctor_id'))
                }else{
                    $('#expert_text').html("请选择指定专家");
                }

            }else{

                $('#expert_text').html("选择知名专家类型后才可以指定专家");
            }
        }
        $('.backView ui li').eq(registerNum-1).addClass('choose-on').siblings().removeClass('choose-on')

        // 用户
        if($.cookie("username")){
            $('#user_name').html($.cookie("username"));
        }

        // 医生
        if($.cookie("hospital_doctor_name")){
            doctorId = $.cookie("hospital_doctor_id");
            doctorName = $.cookie("hospital_doctor_name");
        }

        if($.cookie("severMoney")){
            var money = $.cookie("severMoney");
            $('#money_num').html(money);
            // 删除本地保存
            $.cookie('severMoney', "", { expires: 7,path: '/' });
        }

        // 诊疗金
        if($.cookie("dia_name")){
            diagName = $.cookie("dia_name");
            diagId = $.cookie("dia_id");
            $('#diagnosis_money').html(diagName+"元诊疗金");
            $('#money_num').html(parseInt($('#money_num').text())-parseInt(diagName));
            // 删除本地保存
//            $.cookie('dia_name', "", { expires: 7,path: '/' });
//            $.cookie('dia_id', "", { expires: 7,path: '/' });
        }else{
            $('#diagnosis_money').html();
        }

        $('#diagnosis_money').on('click', function () {
//            alert($('#money_num').text());
            var  money;
            if(diagName){
                money = parseInt($('#money_num').text())+parseInt(diagName);
            }else{
                money = $('#money_num').text();
            }
            $('#money_num').html(money);

            location.href = "../myCenter/diagnosis_money.html?allMoney="+money;
        });

        $('#choosePeople').on('click', function () {
            location.href = "../addPeople/contactPeople.html"
        });

        $('#hospitalDetail').on('click', function () {
            history.go(-2);
            doctorName = $.cookie('hospital_doctor_name', "", { expires: 7,path: '/' });
        });
        //初始化滚动条
        $('[data-slidizle]').slidizle({
            beforeChange : function(api) {
                console.log('previous', api.getPreviousSlide().index());
                console.log('current', api.getCurrentSlide().index());
                console.log('next', api.getNextSlide().index());
                console.log('previous active', api.getPreviousActiveSlide().index());
            }
        });
        app = {
            getworktime: function (doctor_id) {
                $.ajax({
                    type: 'GET',
                    url: textUrl + '/index/getWorkTime',
                    data: {         // 需要于客户端同步
                        uid : '',
                        doctor_id:doctor_id
                    },
                    dataType: 'jsonp',
                    jsonp: 'callback',
                    success: function (result) {
                        if (result.ret == 0) {
                            console.log(result)
                            ///////医生排版信息
                            var workTime = result.data;

                            var now_data = workTime.now_week;

                            for (var now_index in now_data) {

                                var obj = now_data[now_index];

                                loadData("table01", obj, parseInt(now_index) + parseInt(1));

                                if(now_index==0){

                                    $("#table_time_01").text(obj.current_year);
                                }
                            }
                            var next_data = workTime.next_week;
                            for (var next_index in next_data) {


                                var obj = next_data[next_index];

                                loadData("table02", obj, parseInt(next_index) + parseInt(1));

                                if(next_index==0){

                                    $("#table_time_02").text(obj.current_year);
                                }

                            }


                            var next_next_data = workTime.next_next_week;
                            for (var next_next_index in next_next_data) {

                                var obj = next_next_data[next_next_index];

                                loadData("table03", obj, parseInt(next_next_index) + parseInt(1));

                                if(next_next_index==0){

                                    $("#table_time_03").text(obj.current_year);
                                }
                            }
                        } else {
                            alert(result.msg);
                        }
                    }
                });
            },

            getPrice: function () {
                $.ajax({
                    type: 'GET',
                    url: textUrl + '/diagnosis/getPrice/',
                    data: {         // 需要于客户端同步
                        hospital_id : $.cookie("hospital_id"),
                        department_id : $.cookie("department_id"),
                        appointment_type : register_type,
                        doctor_id : doctorId,
                        type : '1',
                        car_on: car,
                        diagnosis_on : diagId,
                        uid : $.cookie("local_userId")
                    },
                    dataType: 'jsonp',
                    jsonp: 'callback',
                    success: function (result) {
                        console.log(result.data)
                        console.log(123)
                        if (result.ret == 0) {
                            $('#carMoney').html(result.data.car_price);
                            $('#severMoney').html(result.data.diagnosis_price);
                            if($.cookie("register_num")){
                                if($.cookie("register_num")==1){
                                    $('#money_num').html(result.data.price_1);
                                }else if($.cookie("register_num")==2){
                                    $('#money_num').html(result.data.price_2);
                                }else if($.cookie("register_num")==3){
                                    $('#money_num').html(result.data.price_3);
                                }else if($.cookie("register_num")==4){
                                    $('#money_num').html(result.data.doctor_price);
                                }
                            }else{
                                $('#money_num').html(result.data.price_1);
                            }
                            //alert($.cookie("moneyNum"))
//                            if($.cookie("moneyNum")){
//                                $('#money_num').html();
//                                $('#money_num').html($.cookie("moneyNum"));
//                                alert(123)
//                            }else{
//                                $('#money_num').html(result.data.price_1);
//                            }
                            $('.choose').eq(0).click(function(){
//                                doctorId = $.cookie('hospital_doctor_id', "", { expires: 7,path: '/' });
//                                doctorName = $.cookie('hospital_doctor_name', "", { expires: 7,path: '/' });
                                $('#money_num').html(result.data.price_1);
                                if($.cookie("sever") == 1){
                                    $('#money_num').html(parseInt(result.data.price_1)+severNum);
                                }
                                if($.cookie("car") == 1){
                                    $('#money_num').html(parseInt(result.data.price_1)+carNum);
                                }
//                                $('#money_num').html();
//                                money_num = $('#money_num').html();
//                                $.cookie('moneyNum',money_num, { expires: 7,path: '/' });
                            })
                            $('.choose').eq(1).click(function(){
//                                doctorId = $.cookie('hospital_doctor_id', "", { expires: 7,path: '/' });
//                                doctorName = $.cookie('hospital_doctor_name', "", { expires: 7,path: '/' });
                                $('#money_num').html(result.data.price_2);
                                if($.cookie("sever") == 1){
                                    $('#money_num').html(parseInt(result.data.price_2)+severNum);
                                }
                                if($.cookie("car") == 1){
                                    $('#money_num').html(parseInt(result.data.price_2)+carNum);
                                }
//                                $('#money_num').html(result.data.price_2);
//                                money_num = $('#money_num').html();
//                                $.cookie('moneyNum', money_num, { expires: 7,path: '/' });
                            })
                            $('.choose').eq(2).click(function(){
//                                doctorId = $.cookie('hospital_doctor_id', "", { expires: 7,path: '/' });
//                                doctorName = $.cookie('hospital_doctor_name', "", { expires: 7,path: '/' });
                                $('#money_num').html(result.data.price_3);
                                if($.cookie("sever") == 1){
                                    $('#money_num').html(parseInt(result.data.price_3)+severNum);
                                }
                                if($.cookie("car") == 1){
                                    $('#money_num').html(parseInt(result.data.price_3)+carNum);
                                }
//                                $('#money_num').html(result.data.price_3);
//                                money_num = $('#money_num').html();
//                                $.cookie('moneyNum', money_num, { expires: 7,path: '/' });
                            })
                            $('.choose').eq(3).click(function(){
//                                doctorId = $.cookie('hospital_doctor_id', "", { expires: 7,path: '/' });
//                                doctorName = $.cookie('hospital_doctor_name', "", { expires: 7,path: '/' });
                                $('#money_num').html(result.data.doctor_price);
                                if($.cookie("sever") == 1){
                                    $('#money_num').html(parseInt(result.data.doctor_price)+severNum);
                                }
                                if($.cookie("car") == 1){
                                    $('#money_num').html(parseInt(result.data.doctor_price)+carNum);
                                }
//                                $('#money_num').html(result.data.doctor_price);
//                                money_num = $('#money_num').html();
//                                $.cookie('moneyNum', money_num, { expires: 7,path: '/' });
                            })
                            severNum = result.data.nurse_price;
                            carNum = result.data.car_price;
                            // 诊疗金
                            if($.cookie("dia_name")){
                                diagName = $.cookie("dia_name");
                                diagId = $.cookie("dia_id");
                                $('#diagnosis_money').html(diagName+"元诊疗金");
                                $('#money_num').html(parseInt($('#money_num').text())-parseInt(diagName));
                            }else{
                                $('#diagnosis_money').html();
                            }
                            if($.cookie("sever") == 1){
                                $('#money_num').html(parseInt($('#money_num').text())+severNum);
                            }
                            if($.cookie("car") == 1){
                                $('#money_num').html(parseInt($('#money_num').text())+carNum);
                            }


                        } else {
                            alert(result.msg);
                        }
                    }
                });
            },
            subOrder: function () {

                $.ajax({
                    type: 'GET',
                    url: textUrl + '/diagnosis/submitOrder/',
                    data: {         // 需要于客户端同步

                        family_id : $.cookie("userId"),
                        hospital_id : $.cookie("hospital_id"),
                        department_id : $.cookie("department_id"),
                        doctor_id : doctorId,
                        appointment_type : register_type,
                        type : '1',
                        uid : $.cookie("local_userId"),
                        appointment_time: $.myTime.DateToUnix("2016-"+appointment_time),
                        mobile : $('#mobile').val(),
                        day_time : time,
                        coupon_id : diagId,
                        car_on : car,
                        diagnosis_on : sever,
                        disease : $('#diseaseText').val()
                    },
                    dataType: 'jsonp',
                    jsonp: 'callback',
                    success: function (result) {
                        if (result.ret == 0) {
console.log(result)
                            // 删除本地保存
                            $.cookie('hospital_doctor_name', "", { expires: 7,path: '/' });
                            $.cookie('hospital_doctor_id', "", { expires: 7,path: '/' });
// 删除本地保存
                            $.cookie('dia_name', "", { expires: 7,path: '/' });
                            $.cookie('dia_id', "", { expires: 7,path: '/' });
                            $.cookie('sever', "", { expires: 7,path: '/' });
                            $.cookie('car', "", { expires: 7,path: '/' });
                            var order = result.data.order_id;
                            var content = result.data.content;
                            var show_status = result.data.show_status;
                            location.href =
                                    "../hospital_nurse/nurse_payorder.html?order_id="+order+'&content='+content+'&show_status='+show_status;
                        } else {
                            alert(result.msg);
                        }
                    }
                });
            }
        };
        /**
         * 加载排班表数据
         */
        function loadData(tableId, obj, index) {

            //设置表头日期
            $("#" + tableId + " tr:eq(0) td:eq(" + index + ")").html('<span class="font">' + obj.week_text + '</span><br/><span style=" font-size: 12px;">' + obj.date + '</span>');

            //设置上午
            if (obj.am == 0) {
                $("#" + tableId + " tr:eq(1) td:eq(" + index + ")").css("background-color", "#f5f5f5");

                $("#" + tableId + " tr:eq(1) td:eq(" + index + ")").html("");
//                $("#" + tableId + " tr:eq(1) td:eq(" + index + ")").html('<span class="num" style="color: #999">预约</span>');
            } else {
                $("#" + tableId + " tr:eq(1) td:eq(" + index + ")").html('<span class="num">预约</span>');
                //$("#" + tableId + " tr:eq(1) td:eq(" + index + ")").css("background-color", "#f5f5f5");
                $("#" + tableId + " tr:eq(1) td:eq(" + index + ")").on('click', function () {
                    //$("#" + tableId + " tr:eq(1) td:eq(" + index + ")").css("background-color", "#f5f5f5");
//                    $(this).css("background-color", "#00b57d").siblings().css("background-color", "rgb(245, 245, 245)");

                    if($.cookie('register_num')==4){

                        $(this).addClass('hover').siblings().removeClass('hover')
                        $(this).parents('li').siblings().find('td').removeClass('hover')
                        $(this).parent().siblings().find('td').removeClass('hover')
                        $(this).find('span').addClass('hover').parents().siblings().find('span').removeClass('hover')
                        //$(this).addClass($(this).css("background-color", "#43AF80"));

                        $(this).html('<span class="font hover">' + obj.week_text + '</span><br/><span class="hover num">上午</span>')
//                        $(this).parent().siblings().eq(1).find('td').html('<span class="font hover">' + obj.week_text + '</span><br/><span class="hover num">上午</span>')
                        appointment_time = obj.date;
                        time = 1;
                    }else{
                        $(this).addClass('hover').siblings().removeClass('hover')
                        $(this).parents('li').siblings().find('td').removeClass('hover')
                        $(this).parent().siblings().find('td').removeClass('hover')
                        $(this).find('span').addClass('hover').parents().siblings().find('span').removeClass('hover')
                        //$(this).addClass($(this).css("background-color", "#43AF80"));

                        $(this).html('<span class="font hover">' + obj.week_text + '</span><br/><span class="hover num">上午</span>').siblings().html('<span class="num" style="color: #00b57d">预约</span>').siblings('.title').html('上午');
                        $(this).parent().siblings().eq(1).find('td').html('<span class="font hover">' + obj.week_text + '</span><br/><span class="hover num">上午</span>').siblings().html('<span class="num" style="color: #00b57d">预约</span>').siblings('.title').html('下午');
                        appointment_time = obj.date;
                        time = 1;
                    }

                });
            }
            //设置下午
            if (obj.pm == 0) {
                $("#" + tableId + " tr:eq(2) td:eq(" + index + ")").css("background-color", "#f5f5f5");
                $("#" + tableId + " tr:eq(2) td:eq(" + index + ")").html("");
//                $("#" + tableId + " tr:eq(2) td:eq(" + index + ")").html('<span class="num" style="color: #999">预约</span>');
            } else {
                if($.cookie('register_num')==4){
                    $("#" + tableId + " tr:eq(2) td:eq(" + index + ")").html('<span class="num am">预约</span>');
                }else{
                    $("#" + tableId + " tr:eq(2) td:eq(" + index + ")").html('<span class="num">预约</span>');
                }

                //$("#" + tableId + " tr:eq(2) td:eq(" + index + ")").css("background-color", "#f5f5f5");
                $("#" + tableId + " tr:eq(2) td:eq(" + index + ")").on('click', function () {
                    //$('.reservation_table table td').css("background-color", "#fff");
                    //$(this).addClass($(this).css("background-color", "#43AF80"));
                    if($.cookie('register_num')==4){
                        $(this).addClass('hover').siblings().removeClass('hover')
                        $(this).parents('li').siblings().find('td').removeClass('hover')
                        $(this).parent().siblings().find('td').removeClass('hover')
                        $(this).find('span').addClass('hover').parents().siblings().find('span').removeClass('hover')
                        $(this).html('<span class="font hover">' + obj.week_text + '</span><br/><span class="hover num">下午</span>')
//                        $(this).parent().siblings().eq(1).find('td').html('<span class="font hover">' + obj.week_text + '</span><br/><span class="hover num">上午</span>').siblings().html('<span class="num" style="color: #00b57d">预约</span>').siblings('.title').html('上午');
                        appointment_time = obj.date;
                        time = 2;
                    }else{
                        $(this).addClass('hover').siblings().removeClass('hover')
                        $(this).parents('li').siblings().find('td').removeClass('hover')
                        $(this).parent().siblings().find('td').removeClass('hover')
                        $(this).find('span').addClass('hover').parents().siblings().find('span').removeClass('hover')
                        $(this).html('<span class="font hover">' + obj.week_text + '</span><br/><span class="hover num">下午</span>').siblings().html('<span class="num" style="color: #00b57d">预约</span>').siblings('.title').html('下午');
                        $(this).parent().siblings().eq(1).find('td').html('<span class="font hover">' + obj.week_text + '</span><br/><span class="hover num">上午</span>').siblings().html('<span class="num" style="color: #00b57d">预约</span>').siblings('.title').html('上午');
                        appointment_time = obj.date;
                        time = 2;
                    }
                });
//                $("#" + tableId + " tr:eq(2) td:eq(" + index + ")").html('<a href="doctor_appointment.html?am=2&day='+obj.day+'&time='+obj.date+'" style="color: white;font-size: 11px">立即<br/>预约</a>');
            }
        }
        var d_id = getQueryString('id');

        app.getPrice();
        if($.cookie("register_num")==4){
            app.getworktime(d_id);
        }else{
            app.getworktime($.cookie('hospital_doctor_id'));
        }
        $('#choose_expert').on('click', function () {
            var department_id = $.cookie("department_id");
            var hospital_id = $.cookie("hospital_id");
            if(register_type == 4){
                location.href = "hospital_doctorList.html?hospital="+hospital_id+"&department="+department_id+""+'&type=1';
            }
        });
        // 立即预约
        $('#submitOrder').on('click', function () {
            if(!appointment_time){
                alert("请选择就诊时间");
                return;
            }
            if($('#mobile').val().length == 0){
                alert("请输入备用联系人手机号");
                return;
            }
            if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test($('#mobile').val()))){
                alert("请输入正确的手机号");
                document.mobileform.mobile.focus();
                return false;
            }
//            if($('#diseaseText').val().length == 0){
//                alert("请输入患者病情");
//                return;
//            }
            app.subOrder();
        });

        $('#back').on('click', function () {
            // 删除本地保存
            $.cookie('dia_name', "", { expires: 7,path: '/' });
            $.cookie('dia_id', "", { expires: 7,path: '/' });
            $.cookie('sever', "", { expires: 7,path: '/' });
            $.cookie('car', "", { expires: 7,path: '/' });
            history.back();
        });
    });
    // 选择名医
    function chooseType(o){
        var num = o.data("id");
        $('.choose').removeClass("choose-on");
        //$('#money_num').html('189')
        o.addClass("choose-on");
        register_type = num;

        $.cookie('register_num', num, { expires: 7,path: '/' });

        if(num == 4){
            if(doctorName){
                $('#expert_text').html(doctorName);

            }else{
                $('#expert_text').html("请选择指定专家");
            }


        }else{
            $('#expert_text').html("选择知名专家类型后才可以指定专家");
            $.cookie('hospital_doctor_id', '', { expires: 7,path: '/' });
        }
        setInterval(function(){
            location.href = window.location
        },200)


//        app.getPrice();
    }

</script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript"></script>
<script src="../js/weixin2.js"></script>
</body>
</html>